package com.leiduoduo.oms.controller;

import com.leiduoduo.oms.annotation.UserLoginToken;
import com.leiduoduo.oms.pojo.Chargeback;
import com.leiduoduo.oms.service.ChargebackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class ChargebackController {
    @Autowired
    ChargebackService chargebackService;

    @PostMapping("/addChargeback")
    @UserLoginToken
    public boolean addChargeback(Chargeback chargeback){
        return chargebackService.addChargeback(chargeback);
    }
    @PostMapping("/delChargeback")
    @UserLoginToken
    public boolean delChargeback(Chargeback chargeback){
        return chargebackService.delChargeback(chargeback);
    }
    @PostMapping("/upChargeback")
    @UserLoginToken
    public boolean upChargeback(Chargeback chargeback){
        return chargebackService.upChargeback(chargeback);
    }
    @GetMapping("/getChargebackById/{id}")
    @UserLoginToken
    public Chargeback getChargebackById(@PathVariable int id){
        return chargebackService.getChargebackById(id);
    }
    @GetMapping("/getChargebackList")
    @UserLoginToken
    public List<Chargeback> getChargebackList(){
        return chargebackService.getChargebackList();
    }
}
